package com.dragon.modules.yuegou.query.product;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dragon.modules.yuegou.entity.product.CoupTemplateEntity;
import com.dragon.modules.yuegou.enums.product.CoupTemplateType;
import com.dragon.modules.yuegou.mybatis.Condition;
import com.dragon.modules.yuegou.mybatis.Query;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonUnwrapped;

import java.time.LocalDateTime;

/**
 * 商品券模板 动态查询条件
 *
 * @author pbuilder generated
 * @date 2021-05-19 17:18:43
 * @version 2.0
 */
@JsonInclude(Include.NON_NULL)
public class CoupTemplateQuery extends CoupTemplateEntity implements Query<CoupTemplateEntity> {

	/** 模板ID查询条件 */
	@JsonUnwrapped(prefix = "id")
	private Condition<String> idCondition;

	/** 商圈ID查询条件 */
	@JsonUnwrapped(prefix = "busdId")
	private Condition<String> busdIdCondition;

	/** 商品券名称查询条件 */
	@JsonUnwrapped(prefix = "title")
	private Condition<String> titleCondition;

	/** 名称备注查询条件 */
	@JsonUnwrapped(prefix = "titleRemark")
	private Condition<String> titleRemarkCondition;

	/** 发放量查询条件 */
	@JsonUnwrapped(prefix = "granted")
	private Condition<Integer> grantedCondition;

	/** [枚举]商品类型：0-平台实物-PLATFORM、1-商户实物-MERCHANT查询条件 */
	@JsonUnwrapped(prefix = "type")
	private Condition<CoupTemplateType> typeCondition;

	/** 活动状态：0-启用-START、1-停用-OVER查询条件 */
	@JsonUnwrapped(prefix = "openType")
	private Condition<Boolean> openTypeCondition;

	/** 使用说明查询条件 */
	@JsonUnwrapped(prefix = "remark")
	private Condition<String> remarkCondition;

	/** 总库存查询条件 */
	@JsonUnwrapped(prefix = "stockTotal")
	private Condition<Integer> stockTotalCondition;

	/** 库存剩余查询条件 */
	@JsonUnwrapped(prefix = "stockSurplus")
	private Condition<Integer> stockSurplusCondition;

	/** 版本查询条件 */
	@JsonUnwrapped(prefix = "version")
	private Condition<Integer> versionCondition;

	/** 创建者查询条件 */
	@JsonUnwrapped(prefix = "createdBy")
	private Condition<String> createdByCondition;

	/** 创建时间查询条件 */
	@JsonUnwrapped(prefix = "createdTime")
	private Condition<LocalDateTime> createdTimeCondition;

	/** 修改人查询条件 */
	@JsonUnwrapped(prefix = "modifiedBy")
	private Condition<String> modifiedByCondition;

	/** 修改时间查询条件 */
	@JsonUnwrapped(prefix = "modifiedTime")
	private Condition<LocalDateTime> modifiedTimeCondition;

	/** 是否删除（1：已删除，0：未删除）查询条件 */
	@JsonUnwrapped(prefix = "del")
	private Condition<Boolean> delCondition;

	/** 删除人查询条件 */
	@JsonUnwrapped(prefix = "delBy")
	private Condition<String> delByCondition;

	/** 删除时间查询条件 */
	@JsonUnwrapped(prefix = "delTime")
	private Condition<LocalDateTime> delTimeCondition;

	/**
	 * 构造一个查询条件对象
	 */
	public CoupTemplateQuery() {
		super();
	}

	/**
	 * 依据实体对象构造一个查询条件对象
	 *
	 * @param entity 实体对象
	 */
	public CoupTemplateQuery(CoupTemplateEntity entity) {
		super(entity);
	}

	/**
	 * 依据其它查询条件对象的信息构造一个查询条件对象
	 *
	 * @param other 查询条件对象
	 */
	public CoupTemplateQuery(CoupTemplateQuery other) {
		super(other);
		if (other.idCondition != null) {
			this.idCondition = other.idCondition.copy();
		}
		if (other.busdIdCondition != null) {
			this.busdIdCondition = other.busdIdCondition.copy();
		}
		if (other.titleCondition != null) {
			this.titleCondition = other.titleCondition.copy();
		}
		if (other.titleRemarkCondition != null) {
			this.titleRemarkCondition = other.titleRemarkCondition.copy();
		}
		if (other.grantedCondition != null) {
			this.grantedCondition = other.grantedCondition.copy();
		}
		if (other.typeCondition != null) {
			this.typeCondition = other.typeCondition.copy();
		}
		if (other.openTypeCondition != null) {
			this.openTypeCondition = other.openTypeCondition.copy();
		}
		if (other.remarkCondition != null) {
			this.remarkCondition = other.remarkCondition.copy();
		}
		if (other.stockTotalCondition != null) {
			this.stockTotalCondition = other.stockTotalCondition.copy();
		}
		if (other.stockSurplusCondition != null) {
			this.stockSurplusCondition = other.stockSurplusCondition.copy();
		}
		if (other.versionCondition != null) {
			this.versionCondition = other.versionCondition.copy();
		}
		if (other.createdByCondition != null) {
			this.createdByCondition = other.createdByCondition.copy();
		}
		if (other.createdTimeCondition != null) {
			this.createdTimeCondition = other.createdTimeCondition.copy();
		}
		if (other.modifiedByCondition != null) {
			this.modifiedByCondition = other.modifiedByCondition.copy();
		}
		this.setother(other);
	}

	private void setother(CoupTemplateQuery other){
		if(other.modifiedTimeCondition != null) {
			this.modifiedTimeCondition = other.modifiedTimeCondition.copy();
		}
		if(other.delCondition != null) {
			this.delCondition = other.delCondition.copy();
		}
		if(other.delByCondition != null) {
			this.delByCondition = other.delByCondition.copy();
		}
		if(other.delTimeCondition != null) {
			this.delTimeCondition = other.delTimeCondition.copy();
		}
	}

	@Override
	public QueryWrapper<CoupTemplateEntity> toQueryWrapper() {
		QueryWrapper<CoupTemplateEntity> wrapper = new QueryWrapper<>(this);
		if (idCondition != null) {
			idCondition.toWrapper(wrapper, COL_ID);
		}
		if (busdIdCondition != null) {
			busdIdCondition.toWrapper(wrapper, COL_BUSD_ID);
		}
		if (titleCondition != null) {
			titleCondition.toWrapper(wrapper, COL_TITLE);
		}
		if (titleRemarkCondition != null) {
			titleRemarkCondition.toWrapper(wrapper, COL_TITLE_REMARK);
		}
		if (grantedCondition != null) {
			grantedCondition.toWrapper(wrapper, COL_GRANTED);
		}
		if (typeCondition != null) {
			typeCondition.toWrapper(wrapper, COL_TYPE);
		}
		if (openTypeCondition != null) {
			openTypeCondition.toWrapper(wrapper, COL_OPEN_TYPE);
		}
		if (remarkCondition != null) {
			remarkCondition.toWrapper(wrapper, COL_REMARK);
		}
		if (stockTotalCondition != null) {
			stockTotalCondition.toWrapper(wrapper, COL_STOCK_TOTAL);
		}
		if (stockSurplusCondition != null) {
			stockSurplusCondition.toWrapper(wrapper, COL_STOCK_SURPLUS);
		}
		if (versionCondition != null) {
			versionCondition.toWrapper(wrapper, COL_VERSION);
		}
		if (createdByCondition != null) {
			createdByCondition.toWrapper(wrapper, COL_CREATED_BY);
		}
		if (createdTimeCondition != null) {
			createdTimeCondition.toWrapper(wrapper, COL_CREATED_TIME);
		}
		if (modifiedByCondition != null) {
			modifiedByCondition.toWrapper(wrapper, COL_MODIFIED_BY);
		}
		return getQueryWrapper(wrapper);
	}

	private QueryWrapper<CoupTemplateEntity> getQueryWrapper(QueryWrapper<CoupTemplateEntity> wrapper){
		if (modifiedTimeCondition != null) {
			modifiedTimeCondition.toWrapper(wrapper, COL_MODIFIED_TIME);
		}
		if (delCondition != null) {
			delCondition.toWrapper(wrapper, COL_DEL);
		}
		if (delByCondition != null) {
			delByCondition.toWrapper(wrapper, COL_DEL_BY);
		}
		if (delTimeCondition != null) {
			delTimeCondition.toWrapper(wrapper, COL_DEL_TIME);
		}
		return wrapper;
	}

	/**
	 * 构造并返回模板ID查询条件
	 *
	 * @return idCondition 模板ID查询条件
	 */
	public Condition<String> id() {
		this.idCondition = new Condition<>();
		return this.idCondition;
	}

	/**
	 * 获取模板ID查询条件
	 *
	 * @return idCondition 模板ID查询条件
	 */
	public Condition<String> getIdCondition() {
		return idCondition;
	}

	/**
	 * 设置模板ID查询条件
	 *
	 * @param idCondition 模板ID查询条件
	 */
	public void setIdCondition(Condition<String> idCondition) {
		this.idCondition = idCondition;
	}

	/**
	 * 构造并返回商圈ID查询条件
	 *
	 * @return busdIdCondition 商圈ID查询条件
	 */
	public Condition<String> busdId() {
		this.busdIdCondition = new Condition<>();
		return this.busdIdCondition;
	}

	/**
	 * 获取商圈ID查询条件
	 *
	 * @return busdIdCondition 商圈ID查询条件
	 */
	public Condition<String> getBusdIdCondition() {
		return busdIdCondition;
	}

	/**
	 * 设置商圈ID查询条件
	 *
	 * @param busdIdCondition 商圈ID查询条件
	 */
	public void setBusdIdCondition(Condition<String> busdIdCondition) {
		this.busdIdCondition = busdIdCondition;
	}

	/**
	 * 构造并返回商品券名称查询条件
	 *
	 * @return titleCondition 商品券名称查询条件
	 */
	public Condition<String> title() {
		this.titleCondition = new Condition<>();
		return this.titleCondition;
	}

	/**
	 * 获取商品券名称查询条件
	 *
	 * @return titleCondition 商品券名称查询条件
	 */
	public Condition<String> getTitleCondition() {
		return titleCondition;
	}

	/**
	 * 设置商品券名称查询条件
	 *
	 * @param titleCondition 商品券名称查询条件
	 */
	public void setTitleCondition(Condition<String> titleCondition) {
		this.titleCondition = titleCondition;
	}

	/**
	 * 构造并返回名称备注查询条件
	 *
	 * @return titleRemarkCondition 名称备注查询条件
	 */
	public Condition<String> titleRemark() {
		this.titleRemarkCondition = new Condition<>();
		return this.titleRemarkCondition;
	}

	/**
	 * 获取名称备注查询条件
	 *
	 * @return titleRemarkCondition 名称备注查询条件
	 */
	public Condition<String> getTitleRemarkCondition() {
		return titleRemarkCondition;
	}

	/**
	 * 设置名称备注查询条件
	 *
	 * @param titleRemarkCondition 名称备注查询条件
	 */
	public void setTitleRemarkCondition(Condition<String> titleRemarkCondition) {
		this.titleRemarkCondition = titleRemarkCondition;
	}

	/**
	 * 构造并返回发放量查询条件
	 *
	 * @return grantedCondition 发放量查询条件
	 */
	public Condition<Integer> granted() {
		this.grantedCondition = new Condition<>();
		return this.grantedCondition;
	}

	/**
	 * 获取发放量查询条件
	 *
	 * @return grantedCondition 发放量查询条件
	 */
	public Condition<Integer> getGrantedCondition() {
		return grantedCondition;
	}

	/**
	 * 设置发放量查询条件
	 *
	 * @param grantedCondition 发放量查询条件
	 */
	public void setGrantedCondition(Condition<Integer> grantedCondition) {
		this.grantedCondition = grantedCondition;
	}

	/**
	 * 构造并返回[枚举]商品类型：0-平台实物-PLATFORM、1-商户实物-MERCHANT查询条件
	 *
	 * @return typeCondition [枚举]商品类型：0-平台实物-PLATFORM、1-商户实物-MERCHANT查询条件
	 */
	public Condition<CoupTemplateType> type() {
		this.typeCondition = new Condition<>();
		return this.typeCondition;
	}

	/**
	 * 获取[枚举]商品类型：0-平台实物-PLATFORM、1-商户实物-MERCHANT查询条件
	 *
	 * @return typeCondition [枚举]商品类型：0-平台实物-PLATFORM、1-商户实物-MERCHANT查询条件
	 */
	public Condition<CoupTemplateType> getTypeCondition() {
		return typeCondition;
	}

	/**
	 * 设置[枚举]商品类型：0-平台实物-PLATFORM、1-商户实物-MERCHANT查询条件
	 *
	 * @param typeCondition [枚举]商品类型：0-平台实物-PLATFORM、1-商户实物-MERCHANT查询条件
	 */
	public void setTypeCondition(Condition<CoupTemplateType> typeCondition) {
		this.typeCondition = typeCondition;
	}

	/**
	 * 构造并返回活动状态：0-启用-START、1-停用-OVER查询条件
	 *
	 * @return openTypeCondition 活动状态：0-启用-START、1-停用-OVER查询条件
	 */
	public Condition<Boolean> openType() {
		this.openTypeCondition = new Condition<>();
		return this.openTypeCondition;
	}

	/**
	 * 获取活动状态：0-启用-START、1-停用-OVER查询条件
	 *
	 * @return openTypeCondition 活动状态：0-启用-START、1-停用-OVER查询条件
	 */
	public Condition<Boolean> getOpenTypeCondition() {
		return openTypeCondition;
	}

	/**
	 * 设置活动状态：0-启用-START、1-停用-OVER查询条件
	 *
	 * @param openTypeCondition 活动状态：0-启用-START、1-停用-OVER查询条件
	 */
	public void setOpenTypeCondition(Condition<Boolean> openTypeCondition) {
		this.openTypeCondition = openTypeCondition;
	}

	/**
	 * 构造并返回使用说明查询条件
	 *
	 * @return remarkCondition 使用说明查询条件
	 */
	public Condition<String> remark() {
		this.remarkCondition = new Condition<>();
		return this.remarkCondition;
	}

	/**
	 * 获取使用说明查询条件
	 *
	 * @return remarkCondition 使用说明查询条件
	 */
	public Condition<String> getRemarkCondition() {
		return remarkCondition;
	}

	/**
	 * 设置使用说明查询条件
	 *
	 * @param remarkCondition 使用说明查询条件
	 */
	public void setRemarkCondition(Condition<String> remarkCondition) {
		this.remarkCondition = remarkCondition;
	}

	/**
	 * 构造并返回总库存查询条件
	 *
	 * @return stockTotalCondition 总库存查询条件
	 */
	public Condition<Integer> stockTotal() {
		this.stockTotalCondition = new Condition<>();
		return this.stockTotalCondition;
	}

	/**
	 * 获取总库存查询条件
	 *
	 * @return stockTotalCondition 总库存查询条件
	 */
	public Condition<Integer> getStockTotalCondition() {
		return stockTotalCondition;
	}

	/**
	 * 设置总库存查询条件
	 *
	 * @param stockTotalCondition 总库存查询条件
	 */
	public void setStockTotalCondition(Condition<Integer> stockTotalCondition) {
		this.stockTotalCondition = stockTotalCondition;
	}

	/**
	 * 构造并返回库存剩余查询条件
	 *
	 * @return stockSurplusCondition 库存剩余查询条件
	 */
	public Condition<Integer> stockSurplus() {
		this.stockSurplusCondition = new Condition<>();
		return this.stockSurplusCondition;
	}

	/**
	 * 获取库存剩余查询条件
	 *
	 * @return stockSurplusCondition 库存剩余查询条件
	 */
	public Condition<Integer> getStockSurplusCondition() {
		return stockSurplusCondition;
	}

	/**
	 * 设置库存剩余查询条件
	 *
	 * @param stockSurplusCondition 库存剩余查询条件
	 */
	public void setStockSurplusCondition(Condition<Integer> stockSurplusCondition) {
		this.stockSurplusCondition = stockSurplusCondition;
	}

	/**
	 * 构造并返回版本查询条件
	 *
	 * @return versionCondition 版本查询条件
	 */
	public Condition<Integer> version() {
		this.versionCondition = new Condition<>();
		return this.versionCondition;
	}

	/**
	 * 获取版本查询条件
	 *
	 * @return versionCondition 版本查询条件
	 */
	public Condition<Integer> getVersionCondition() {
		return versionCondition;
	}

	/**
	 * 设置版本查询条件
	 *
	 * @param versionCondition 版本查询条件
	 */
	public void setVersionCondition(Condition<Integer> versionCondition) {
		this.versionCondition = versionCondition;
	}

	/**
	 * 构造并返回创建者查询条件
	 *
	 * @return createdByCondition 创建者查询条件
	 */
	public Condition<String> createdBy() {
		this.createdByCondition = new Condition<>();
		return this.createdByCondition;
	}

	/**
	 * 获取创建者查询条件
	 *
	 * @return createdByCondition 创建者查询条件
	 */
	public Condition<String> getCreatedByCondition() {
		return createdByCondition;
	}

	/**
	 * 设置创建者查询条件
	 *
	 * @param createdByCondition 创建者查询条件
	 */
	public void setCreatedByCondition(Condition<String> createdByCondition) {
		this.createdByCondition = createdByCondition;
	}

	/**
	 * 构造并返回创建时间查询条件
	 *
	 * @return createdTimeCondition 创建时间查询条件
	 */
	public Condition<LocalDateTime> createdTime() {
		this.createdTimeCondition = new Condition<>();
		return this.createdTimeCondition;
	}

	/**
	 * 获取创建时间查询条件
	 *
	 * @return createdTimeCondition 创建时间查询条件
	 */
	public Condition<LocalDateTime> getCreatedTimeCondition() {
		return createdTimeCondition;
	}

	/**
	 * 设置创建时间查询条件
	 *
	 * @param createdTimeCondition 创建时间查询条件
	 */
	public void setCreatedTimeCondition(Condition<LocalDateTime> createdTimeCondition) {
		this.createdTimeCondition = createdTimeCondition;
	}

	/**
	 * 构造并返回修改人查询条件
	 *
	 * @return modifiedByCondition 修改人查询条件
	 */
	public Condition<String> modifiedBy() {
		this.modifiedByCondition = new Condition<>();
		return this.modifiedByCondition;
	}

	/**
	 * 获取修改人查询条件
	 *
	 * @return modifiedByCondition 修改人查询条件
	 */
	public Condition<String> getModifiedByCondition() {
		return modifiedByCondition;
	}

	/**
	 * 设置修改人查询条件
	 *
	 * @param modifiedByCondition 修改人查询条件
	 */
	public void setModifiedByCondition(Condition<String> modifiedByCondition) {
		this.modifiedByCondition = modifiedByCondition;
	}

	/**
	 * 构造并返回修改时间查询条件
	 *
	 * @return modifiedTimeCondition 修改时间查询条件
	 */
	public Condition<LocalDateTime> modifiedTime() {
		this.modifiedTimeCondition = new Condition<>();
		return this.modifiedTimeCondition;
	}

	/**
	 * 获取修改时间查询条件
	 *
	 * @return modifiedTimeCondition 修改时间查询条件
	 */
	public Condition<LocalDateTime> getModifiedTimeCondition() {
		return modifiedTimeCondition;
	}

	/**
	 * 设置修改时间查询条件
	 *
	 * @param modifiedTimeCondition 修改时间查询条件
	 */
	public void setModifiedTimeCondition(Condition<LocalDateTime> modifiedTimeCondition) {
		this.modifiedTimeCondition = modifiedTimeCondition;
	}

	/**
	 * 构造并返回是否删除（1：已删除，0：未删除）查询条件
	 *
	 * @return delCondition 是否删除（1：已删除，0：未删除）查询条件
	 */
	public Condition<Boolean> del() {
		this.delCondition = new Condition<>();
		return this.delCondition;
	}

	/**
	 * 获取是否删除（1：已删除，0：未删除）查询条件
	 *
	 * @return delCondition 是否删除（1：已删除，0：未删除）查询条件
	 */
	public Condition<Boolean> getDelCondition() {
		return delCondition;
	}

	/**
	 * 设置是否删除（1：已删除，0：未删除）查询条件
	 *
	 * @param delCondition 是否删除（1：已删除，0：未删除）查询条件
	 */
	public void setDelCondition(Condition<Boolean> delCondition) {
		this.delCondition = delCondition;
	}

	/**
	 * 构造并返回删除人查询条件
	 *
	 * @return delByCondition 删除人查询条件
	 */
	public Condition<String> delBy() {
		this.delByCondition = new Condition<>();
		return this.delByCondition;
	}

	/**
	 * 获取删除人查询条件
	 *
	 * @return delByCondition 删除人查询条件
	 */
	public Condition<String> getDelByCondition() {
		return delByCondition;
	}

	/**
	 * 设置删除人查询条件
	 *
	 * @param delByCondition 删除人查询条件
	 */
	public void setDelByCondition(Condition<String> delByCondition) {
		this.delByCondition = delByCondition;
	}

	/**
	 * 构造并返回删除时间查询条件
	 *
	 * @return delTimeCondition 删除时间查询条件
	 */
	public Condition<LocalDateTime> delTime() {
		this.delTimeCondition = new Condition<>();
		return this.delTimeCondition;
	}

	/**
	 * 获取删除时间查询条件
	 *
	 * @return delTimeCondition 删除时间查询条件
	 */
	public Condition<LocalDateTime> getDelTimeCondition() {
		return delTimeCondition;
	}

	/**
	 * 设置删除时间查询条件
	 *
	 * @param delTimeCondition 删除时间查询条件
	 */
	public void setDelTimeCondition(Condition<LocalDateTime> delTimeCondition) {
		this.delTimeCondition = delTimeCondition;
	}

}
